package com.ytktt.study.week9.task7.transaction.controller;

import com.ytktt.study.week9.task7.transaction.service.TransactionService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO
 *
 * @author ytk
 */
@RestController
@RequestMapping("/transaction")
@RequiredArgsConstructor
public class TransactionController {

    private final TransactionService transactionService;

    @PostMapping(value = "/exchange")
    public String exchange() {
        this.transactionService.exchange();
        return "success";
    }

    @PostMapping(value = "/exchange/tryException")
    public String exchangeTryException() {
        this.transactionService.exchangeTryException();
        return "success";
    }
}
